<template>
	<view>
		<div v-if="goodList.length" >
			<div class="good-box" @click="toPdd(good)" v-for="(good,index) in goodList" :key="index"  >
				<div class="left">
					<image :src="good.goods_image_url" mode=""></image>
				</div>
				<div class="right">
					<view class="u-line-2 good-name">
						{{good.goods_name}}
					</view>
					<!-- <div class="fl-box">约返 {{good.promotion_rate}} 元</div> -->
					<div class="price-box">
						<div class="price">
							￥<text>{{good.min_group_price/100}}</text>
						</div>
						<div class="del">
							原价 ：￥{{good.min_normal_price/100}}
						</div>
					</div>
					<div class="store">
						拼多多 |  {{good.brand_name}} {{good.sales_tip}}人付款
					</div>
				</div>
			</div>
		</div>
		<div v-else style="padding-top: 100rpx;">
			<u-empty margin-top="50rpx" mode="list"></u-empty>
		</div>
	</view>
</template>

<script>
	import Good from '../components/goodPDD/index.vue'
	export default {
		components:{
			Good
		},
		data() {
			return {
				key: '',
				goodList:[]
			};
		},
		onLoad(OPT) {
			this.key = OPT.key
			this.getSearchList()
		},
		methods: {
			async getSearchList() {
				const res = await this.$api.pddApi.search({
					keyword: this.key
				})
				console.log(res,'=pdd');
				this.goodList = res.data
			},
			toPdd(info){
					this.$api.pddApi.getSortLink({
						goods_sign: info.goods_sign
					}).then(e => {
						console.log(e, '-=');
						plus.runtime.openURL(e.data[0].mobile_url, function(res) {
				
						})
					})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.good-box{
		padding: 36rpx 24rpx;
		display: flex;
		align-content: center;
		margin-bottom: 14rpx;
		.left{
			width: 200rpx;
			height: 200rpx;
			background: #EEEEEE;
			border-radius: 16rpx;
			overflow: hidden;
			margin-right: 24rpx;
			>image{
				width: 100%;
				height: 100%;
			}
		}
		.right{
			flex: 1;
			.good-name{
				margin-bottom: 12rpx;
			}
			.fl-box{
				display: flex;
				align-items: center;
				justify-content: center;
				font-weight: 400;
				font-size: 20rpx;
				color: #FF8C19;
				width: 132rpx;
				height: 28rpx;
				border-radius: 4rpx;
				border: 1rpx solid #FF8C19;
				margin-bottom: 26rpx;
			}
			.price-box{
				display: flex;
				align-items: center;
				margin-bottom: 12rpx;
				.price{
					font-size: 22rpx;
					margin-right: 12rpx;
					>text{
						font-size: 36rpx;
						font-weight: bold;
					}
				}
				.del{
					text-decoration: line-through;
					font-weight: 400;
					font-size: 24rpx;
					color: #D9D4D0;
				}
			}
			.store{
				font-weight: 400;
				font-size: 20rpx;
				color: #999390;
			}
			
		}
	}

</style>